﻿#include "widget.h"
#include "ui_widget.h"

Widget::Widget(QWidget *parent) :
    QWidget(parent),
    ui(new Ui::Widget)
{
    ui->setupUi(this);
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_pushButton_clicked()
{
    mWidget = new QWidget;
    mWidget->setStyleSheet("QWidget{background-color:blue}");
    mWidget->resize(10, 10);
    mLabel = new QLabel(mWidget);
    mLabel->setText(QStringLiteral("无边框"));
    FramelessWidget *widget = new FramelessWidget;
    widget->setWindowModality(Qt::ApplicationModal);
    connect(widget, &FramelessWidget::sigClose, this, [=](){
        widget->close();
    });
    mWidget->setWindowFlags(mWidget->windowFlags() | Qt::FramelessWindowHint);
    widget->setCenterWidget(mWidget);
    widget->show();
}
